﻿
@{
    ViewBag.Title = "SeeAll";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link rel="stylesheet" href="~/Template/ace_admin_v1.4.0/components/bootstrap-datepicker/dist/css/bootstrap-datepicker3.css" />
<script src="~/Template/ace_admin_v1.4.0/components/bootstrap-datepicker/dist/js/bootstrap-datepicker.js"></script>
<script src="~/Template/ace_admin_v1.4.0/components/moment/moment.js"></script>
<script src="~/Template/ace_admin_v1.4.0/components/_mod/jquery.nestable/jquery.nestable.js"></script>
<div class="row" id="app">
    <div class="col-lg-12">
        <!--时间-->
        <div class="row">
            <div class="col-xs-12">
                <div class="form-horizontal" role="form">
                    <div class="form-group">
                        <label class="col-sm-3 control-label no-padding-right" data-rel="tooltip" title="哪个月的工作计划"> 所属时间 </label>
                        <div class="col-sm-5">
                            <div class="input-group">
                                <input class="form-control date-picker" readonly="readonly" type="text" data-date-format="yyyy-mm" id="sssj" />
                                <span class="input-group-addon">
                                    <i class="fa fa-calendar bigger-110"></i>
                                </span>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <!--工作计划列表-->
        <div class="row" id="gzjhlist">
            <div class="col-lg-12">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                        <tr>
                            <th class="center">
                                名称
                            </th>
                            <th></th>
                        </tr>
                    </thead>

                    <tbody>
                        <tr v-for="tr in gzjhlist">
                            <td class="center">
                                {{tr.mbmc}}
                            </td>
                            <td>

                                <div class="btn-group">
                                    <button data-toggle="dropdown" class="btn btn-primary btn-white dropdown-toggle btn-sm">
                                        操作
                                        <i class="ace-icon fa fa-angle-down icon-on-right"></i>
                                    </button>

                                    <ul class="dropdown-menu">
                                        <li>
                                            <a href="javascript:void(0)" v-on:click="ShowRenYuanList(tr.mbid)">查看</a>
                                        </li>
                                    </ul>
                                </div><!-- /.btn-group -->
                            </td>

                        </tr>

                    </tbody>
                </table>
            </div>
        </div>


        <!--工作计划详细信息-->
        <div class="row" id="gongzuojihuainfo" style="display: none">
            <div class="col-xs-12  widget-container-col">
                <!-- #section:custom/widget-box -->
                <div class="widget-box">
                    <div class="widget-header">
                        <h5 class="widget-title">编辑区</h5>

                        <!-- #section:custom/widget-box.toolbar -->
                        <div class="widget-toolbar">
                            <div class="widget-menu">
                                <a href="#" data-action="settings" data-toggle="dropdown">
                                    <i class="ace-icon fa fa-bars"></i>
                                </a>

                                <ul class="dropdown-menu dropdown-menu-right dropdown-light-blue dropdown-caret dropdown-closer">
                                    <li>
                                        <a data-toggle="tab" href="#dropdown1" v-on:click="ShowList()">返回列表</a>
                                    </li>

                                </ul>
                            </div>


                        </div>

                        <!-- /section:custom/widget-box.toolbar -->
                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-horizontal" role="form">
                                <div class="row">
                                    <div class="col-xs-5">
                                        <div class="input-group">
                                            <span class="input-group-addon">
                                                工作计划名称：
                                            </span>
                                            <input type="text" class="form-control search-query" placeholder="工作计划名称" readonly="readonly" v-bind:value="khbinfo.xingming+khbinfo.mkhbmc" />

                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <template v-for="tr in khbinfo.MyKaoHeBiaoOnes">
                                        <table class="table  table-bordered table-hover">
                                            <thead class="thin-border-bottom">
                                                <tr>
                                                    <th>
                                                        名称
                                                    </th>
                                                    <th>分值</th>
                                                </tr>
                                            </thead>

                                            <tbody>

                                                <tr>
                                                    <td>
                                                        {{tr.mbnr}}
                                                    </td>

                                                    <td>
                                                        {{tr.fz}}
                                                    </td>
                                                </tr>
                                                <tr class="detail-row open">
                                                    <td colspan="2">
                                                        <div class="table-detail">
                                                            <div class="row">
                                                                <div class="col-xs-12">

                                                                    <table class="table table-striped table-bordered table-hover no-margin-bottom no-border-top">
                                                                        <thead>
                                                                            <tr>
                                                                                <th style="width: 350px">工作计划</th>
                                                                                <th style="width: 150px">预计完成时间</th>
                                                                                <th style="width: 400px">完成情况</th>
                                                                                <th style="width: 20px">分值</th>
                                                                                <th style="width: 30px">自评分</th>
                                                                                <th style="width: 30px">评分</th>
                                                                            </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                            <tr v-for="son in tr.MyKaoHeBiaoTwos">
                                                                                <td>
                                                                                    <a href="javascript:void(0)" v-on:click="ShowZuiSu()">{{son.mbnr}}</a>
                                                                                </td>
                                                                                <td>{{son.gzjhwcsjstr}}</td>
                                                                                <td>
                                                                                    <template v-if="son.MyKaoHeBiaotwoFuJianses.length>
                                                                                            0">
                                                                                        <a href="javascript:void(0)" v-on:click="showfujian(son.twoid)">{{son.gzjhwcqk}}</a>
                                                                                    </template>
                                                                                    <template v-if="son.MyKaoHeBiaotwoFuJianses.length==
                                                                                            0">
                                                                                        {{son.gzjhwcqk}}
                                                                                    </template>
                                                                                </td>

                                                                                <td>
                                                                                    {{son.fz}}
                                                                                </td>

                                                                                <td>
                                                                                    {{son.zp}}
                                                                                </td>
                                                                                <td>
                                                                                    {{son.zf}}
                                                                                </td>
                                                                            </tr>
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </td>
                                                </tr>

                                            </tbody>
                                        </table>
                                    </template>
                                </div>
                                <div class="clearfix form-actions">
                                    <div class="col-md-offset-1 col-md-11">
                                        <button class="btn btn-white btn-info btn-bold" type="button" v-on:click="ShowList">
                                            <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>
                                            返回列表
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- /section:custom/widget-box -->
            </div>

            <!-- /.span -->
        </div>
        <!--弹出框-->
        <div class="row">
            <div class="col-xs-12">
                <div id="dialog-message" class="hide">
                    <div class="row" id="renyuangongzuojihualist">
                        <div class="col-lg-12">

                            <table class="table table-striped table-bordered table-hover" id="ttttt">
                                <thead>
                                    <tr>
                                        <th class="center">
                                            名称
                                        </th>
                                        <th class="center">姓名</th>
                                        <th>创建时间</th>
                                        <th>所属时间</th>
                                        <th>状态</th>
                                        <th></th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr v-for="tr in khblist">
                                        <td class="center">
                                            {{tr.mkhbmc}}
                                        </td>
                                        <td class="center">
                                            {{tr.xingming}}
                                        </td>
                                        <td>
                                            {{tr.cjsjstr}}
                                        </td>
                                        <td>
                                            {{tr.sssjstr}}
                                        </td>
                                        <td>
                                            <template v-if="tr.khbzt==1">
                                                创建完成
                                            </template>
                                            <template v-if="tr.khbzt==2">
                                                编辑中
                                            </template>
                                            <template v-if="tr.khbzt==3">
                                                提交审核
                                            </template>
                                            <template v-if="tr.khbzt==4">
                                                通过审核
                                            </template>
                                        </td>
                                        <td>
                                            <button type="button" class="btn btn-white btn-inverse btn-sm" v-on:click="ShowKaoHeBiaoInfo(tr.mkhbid)">查看</button>
                                            <button type="button" class="btn btn-white btn-inverse btn-sm" v-on:click="PrintGongZuoJiHua(tr.mkhbid)">打印</button>
                                        </td>

                                    </tr>

                                </tbody>
                            </table>
                        </div>
                    </div>
                </div><!-- #dialog-message -->
            </div>
        </div>
        <!--弹出框-->
        <div class="row">
            <div class="col-xs-12">
                <div id="dialog-linshigongzuo" class="hide">
                    <div class="row">
                        <div class="col-xs-12">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th class="center">
                                            附件
                                        </th>
                                        <th>标题</th>
                                    </tr>
                                </thead>

                                <tbody>
                                    <tr v-for="tr in uploaderfiles">
                                        <td class="center">
                                            <a v-bind:href="tr.path" target="_blank"><img width="50" height="50" v-bind:src="tr.path" /></a>
                                        </td>
                                        <td>{{tr.fjmc}}</td>

                                    </tr>
                                </tbody>
                            </table>
                        </div><!-- /.span -->
                    </div><!-- /.row -->


                </div><!-- #dialog-message -->
            </div>
        </div>
        <!--弹出框工作计划追溯-->
        <div class="row">
            <div class="col-xs-12">
                <div id="dialog-gongzuozuisu" class="hide">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="dd dd-draghandle">
                                <ol class="dd-list">
                                    
                                    <li class="dd-item dd2-item" data-id="1">
                                        <div class="dd2-content ">给王黎红</div>
                                        <ol class="dd-list">
                                            <li class="dd-item dd2-item" data-id="2">
                                                <div class="dd2-content">分解1</div>
                                            </li>
                                            <li class="dd-item dd2-item dd-colored" data-id="3">
                                                <div class="dd2-content">分解2</div>
                                                <ol class="dd-list">
                                                    <li class="dd-item dd2-item" data-id="16">
                                                        <div class="dd2-content">Active Users</div>
                                                    </li>
                                                </ol>
                                            </li>
                                            <li class="dd-item dd2-item" data-id="4">
                                                <div class="dd2-content">分解3</div>
                                            </li>
                                        </ol>
                                    </li>
                                </ol>
                            </div>
                        </div><!-- /.span -->
                    </div><!-- /.row -->


                </div><!-- #dialog-message -->
            </div>
        </div>
    </div>
</div>
<script src="~/Scripts/JsModel/Model_GongZuoJiHua.js"></script>
<script src="~/Scripts/JsModel/Model_KaoHeBiao.js"></script>
<script type="text/javascript">
    var vm = new Vue(
        {
            el: "#app",
            data: {
                gzjhlist: [],
                khbinfo: new KaoHeBiao(),
                gzjhdialog: {},
                khblist: [],
                mbid: 0,
                yijian: "",
                uploaderfiles:[]
            },
            mounted() {

                this.initPage();
            },
            methods: {
                initPage: function() {
                    $('.date-picker').datepicker({
                        language: "zh-CN",
                        autoclose: true,
                        format: "yyyy-mm",
                        minViewMode: 1
                    }).next().on(ace.click_event,
                        function() {
                            $(this).prev().focus();
                        });
                    $('[data-rel=tooltip]').tooltip();
                    var _self = this;
                    _self.p_Gets();
                    $('.dd').nestable();
                    //$('.dd-handle a').on('mousedown', function(e){
                    //    e.stopPropagation();
                    //});
                    //$('[data-rel="tooltip"]').tooltip();
                },
                p_SouSuo: function () {

                },
                p_Gets: function() { //获取工作计划模版
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GetGZJHs", "Review")").then((response) => {
                            _self.gzjhlist = [];
                            for (var i = 0; i < response.data.length; i++) {
                                _self.gzjhlist.push(response.data[i]);
                        }
                            $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_GetKaoHeBiao: function(mbid) { //通过模板获取审核人员的工作计划
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GetAllIngKaoHeBiaosByKeShenHe", "Review")", { params: { datetimes: $("#sssj").val(), mbid: mbid } }).then((response) => {
                            _self.khblist = [];
                            for (var i = 0; i < response.data.length; i++) {
                                _self.khblist.push(response.data[i]);
                        }
                            $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_GetKaoHeBiaoInfo: function(mkhbid) {
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GetKaoHeBiaoInfoGZJH", "Review")", { params: { mkhbid: mkhbid } }).then((response) => {
                        _self.khbinfo = new KaoHeBiao(response.data);
                        $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_UpdateOk: function(mkhbid) {//通过
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GongZuoJiHuaOK", "Review")", { params: { mkhbid: mkhbid } }).then((response) => {
                            bootbox.alert("已通过",
                                function() {
                                    $("#gongzuojihuainfo").hide(function() {
                                        $("#gzjhlist").show();
                                    });
                                });
                            $.closeloading();
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                p_UpdateReject: function (mkhbid) {//驳回
                    var _self = this;
                    axios.post("@Url.Action("GongZuoJiHuaReject", "Review")",  { mkhbid: mkhbid ,yijian:_self.yijian }).then((response) => {
                            bootbox.alert("已驳回",
                                function () {
                                    _self.yijian = "";
                                    $("#gongzuojihuainfo").hide(function() {
                                        $("#gzjhlist").show();
                                    });
                                });
                        },
                        (response) => {

                        }
                    ).catch(function(response) {
                        console.log(response);
                    });
                },
                DownLoad: function() {
                    var _self = this;
                    window.open(encodeURI("/Review/DownLoadAll?datetimes="+$("#sssj").val()+"mbid="+_self.mbid, "_blank"));

                },
                ShowRenYuanList: function (mbid) {
                    var sssj = $("#sssj").val();
                    if (sssj) {
                        var _self = this;
                        _self.mbid = mbid;
                        _self.p_GetKaoHeBiao(mbid);
                        _self.gzjhdialog = dialog_comm(false, "dialog-message", "选择人员", null, function () { }, true, 700);
                    } else {
                        bootbox.alert("请选择所属时间");
                    }

                    //_self.gzjhdialog.dialog("close");
                },
                ShowKaoHeBiaoInfo: function(mkhbid) {
                    var _self = this;
                    _self.p_GetKaoHeBiaoInfo(mkhbid);
                    $("#gzjhlist").hide(function() {
                        $("#gongzuojihuainfo").show();
                    });
                    _self.gzjhdialog.dialog("close");
                },
                ShowList: function() {
                    var _self = this;
                    $("#gongzuojihuainfo").hide(function () {
                        $("#gzjhlist").show();
                    });
                    _self.khbinfo = new KaoHeBiao();
                },
                TongGuo: function (mkhbid) {
                    var _self = this;
                    _self.p_UpdateOk(mkhbid);
                },
                BoHui: function (mkhbid) {
                    var _self = this;
                    var bohui = dialog_comm(true, "dialog-bohuiyijian", "驳回意见", null, function () { _self.p_UpdateReject(mkhbid) }, true, 700);
                    //_self.p_UpdateReject(mkhbid);
                },
                showfujian: function (twoid) {
                    var _self = this;
                    var dialog = dialog_comm(false, "dialog-linshigongzuo", "查看附件", null, function () { }, true,600);
                    _self.GetFileList(_self.khbinfo.mkhbid, twoid);
                    //e.preventDefault();
                },
                GetFileList: function (mkhbid, twoid) {
                    var _self = this;
                    $.showloading();
                    axios.get("@Url.Action("GetFileList", "MyCaoZuo")", { params: { mkhbid: mkhbid, twoid: twoid } })
                        .then((response) => {
                                _self.uploaderfiles = [];
                                for (var i = 0; i < response.data.length; i++) {
                                    _self.uploaderfiles.push(new MyKaoHeBiaoTwoFuJian(response.data[i]));
                            }
                                $.closeloading();
                            },
                            (response) => {

                            }
                        ).catch(function(response) {
                            console.log(response);
                        });
                },
                PrintGongZuoJiHua(id) {
                    window.location.href = "@Url.Action("PrintGongZuoJiHua","Review")"+"?id="+id;     //在同当前窗口中打开窗口
                },
                ShowZuiSu() {
                    var _self = this;
                    var dialog = dialog_comm(false, "dialog-gongzuozuisu", "工作计划追溯", null, function () { }, true,800);
                    //e.preventDefault();
                }
            }
        });
</script>